package com.example.myproject.redis.redission.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Service
public class RedisOpsHashClient {

    @Autowired
    private RedisTemplate coredisFrameTemplate;

    public RedisOpsHashClient() {
    }

    public long delete(String key, String... hashKeys) {
        return this.coredisFrameTemplate.opsForHash().delete(key, hashKeys);
    }

    public Map<Object, Object> entries(String key) {
        return this.coredisFrameTemplate.opsForHash().entries(key);
    }

    public Object get(String key, String hashKey) {
        return this.coredisFrameTemplate.opsForHash().get(key, hashKey);
    }

    public boolean hasKey(String key, String hashKey) {
        return this.coredisFrameTemplate.opsForHash().hasKey(key, hashKey);
    }

    public long increment(String key, String hashKey, long delta) {
        return this.coredisFrameTemplate.opsForHash().increment(key, hashKey, delta);
    }

    public Set<Object> keys(String key) {
        return this.coredisFrameTemplate.opsForHash().keys(key);
    }

    public List<Object> multiGet(String key, Collection<Object> hashKeys) {
        return this.coredisFrameTemplate.opsForHash().multiGet(key, hashKeys);
    }

    public void put(String key, String hashKey, Object value) {
        this.coredisFrameTemplate.opsForHash().put(key, hashKey, value);
    }

    public void putAll(String key, Map<String, Object> paramMap) {
        this.coredisFrameTemplate.opsForHash().putAll(key, paramMap);
    }

    public boolean putIfAbsent(String key, String hashKey, Object value) {
        return this.coredisFrameTemplate.opsForHash().putIfAbsent(key, hashKey, value);
    }

    public long size(String key) {
        return this.coredisFrameTemplate.opsForHash().size(key);
    }

    public List<Object> values(String key) {
        return this.coredisFrameTemplate.opsForHash().values(key);
    }
}
